package schoolWork.work03.text4;

public class MyTriangle implements IShape{

    double x,y,z;
    double s;

    public MyTriangle(double x, double y, double z) {
        this.x = x;
        this.y = y;
        this.z = z;
    }

    @Override
    public double area() {
        s = (x+y+z)/2;
        return Math.sqrt(s*(s-x)*(s-y)*(s-z));
    }

    @Override
    public double perimeter() {
        return x+y+z;
    }

    public String toString(){
        return "three sides: "+x+", "+y+", "+z+", perimeter="
                +perimeter()+", area="+area();
    }
}
